<%@page import="com.db.DataBase"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  
  
      <table border="1" style="width:80%">
      <tr>
          <th>ID</th>
          <th>登录名</th>
          <th>真实名</th>
          <th>联系方式</th>
      </tr>
    <%
    
         DataBase db =new DataBase();
         java.sql.Connection cnn= db.getConnection();
         java.sql.Statement smt = cnn.createStatement();
         String sql="select * from StationUser";
         java.sql.ResultSet rs = smt.executeQuery(sql); //执行select语句使用executeQuery方法
         
         //smt.executeUpdate(" update StationUser set Mobile='135667677' where autonum='1'")  //执行插入，更新，删除使用executeUpdate方法
    
         while(rs.next())
         {
            String id = rs.getInt("autonum")+"";
            String loginName = rs.getString("username").trim();
            String realName = rs.getString("userealname").trim();
            String telphone = rs.getString("Mobile");
            
            out.write("<tr>");
            out.write("<td>"+id+"</td>");
            out.write("<td>"+loginName+"</td>");
            out.write("<td>"+realName+"</td>");
            out.write("<td>"+telphone+"</td>");
            out.write("<tr>");
         
         }
         
    
     %>
     </table>

  </body>
</html>
